import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import {createSvgIconsPlugin} from 'vite-plugin-svg-icons'
import {viteMockServe } from 'vite-plugin-mock'
// https://vitejs.dev/config/
export default defineConfig(({command})=>{
  return {
    plugins: [
      vue(),
      createSvgIconsPlugin({
        iconDirs:[path.resolve(process.cwd(),'src/assets/icons')],
        symbolId:'icon-[dir]-[name]'
      }),
      viteMockServe({
        localEnabled:command === 'serve' ,
      })
    ],
    resolve:{
      alias:{
        "@":path.resolve(__dirname,'src')
      }
    },
    // scss全局变量的配置
    css:{
      preprocessorOptions:{
        scss:{
          javascriptEnabled:true,
          additionalData:'@import "./src/style/variable.scss";'
        }
      }
    }
  }
  
})